package crm.model.teacherPC.bannedList;

import java.util.ArrayList;

public class BrowserBanned implements BannInterface{
	ArrayList <Browser> bannedList;
	public BrowserBanned() {
		bannedList = new ArrayList<Browser>();
	}

	public boolean match(String name) {
		for (Browser browserName: bannedList){
			System.out.println(name +"=="+ browserName);
			if (name.toLowerCase().contains(browserName.name.toLowerCase()) && browserName.enable){
				System.out.println("BrowserBann true");
				return true;
			}
		}
		System.out.println("BrowserBann false");
		return false;
	}

	public void addBrowser(String browserName){
		bannedList.add(new Browser(browserName, false));
		System.out.println(browserName);
	}
	public void addBrowser(String browserName, boolean enable){
		bannedList.add(new Browser(browserName, enable));
		System.out.println(browserName);
	}

	public Browser getBannedBrowser(int i){
		return bannedList.get(i);
	}

	public int getNOfBannedBrowsers(){
		return bannedList.size();
	}

	@Override
	public ArrayList getList() {
		// TODO Auto-generated method stub
		return bannedList;
	}

	@Override
	public void addBann(String name) {
		bannedList.add(new Browser(name, false));
	}

	@Override
	public int getNOfBann() {
		// TODO Auto-generated method stub
		return 0;
	}

}
